package com.lovo.lesson;

import java.util.ArrayList;
import java.util.TreeSet;

public class Test05 {
    public static void main(String[] args) {
        TreeSet treeSet = new TreeSet();
//        treeSet.add(100);
//        treeSet.add(200);
//        treeSet.add(300);
//        treeSet.add("Hello TreeSet");
//        treeSet.add("Hello TreeSet1");
//        treeSet.add("Hello TreeSet2");
//        treeSet.add(false);
        treeSet.add(new Student("小强",20,"男"));
        treeSet.add(new Student("小强1",18,"男"));
        treeSet.add(new Student("小强2",23,"男"));
        treeSet.add(new Student("小强3",15,"男"));
        treeSet.add(new Student("小强4",25,"男"));
        treeSet.add(new Student("小强5",19,"男"));

        for(Object obj : treeSet){
            System.out.println(obj);
        }

        ArrayList list = new ArrayList();
        list.addAll(treeSet);
        System.out.println(list);
    }
}
